package com.todo.biz.application.backend.controller;

import com.todo.biz.application.backend.service.FeedbackBackendService;
import com.todo.biz.iface.backend.FeedbackBackendIface;
import com.todo.biz.iface.backend.request.*;
import com.todo.biz.iface.backend.response.*;
import com.todo.common.common.entity.response.BizPageResponse;
import com.todo.common.common.entity.response.BizResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author azhebuxing
 * @date 2024/12/14 16:12
 * @description
 */
@RestController
@RequestMapping("/bd/bizBase/feedback")
@Tag(name = "反馈信息处理类", description = "反馈信息处理类")
public class FeedbackBackendController implements FeedbackBackendIface {

    @Resource
    private FeedbackBackendService feedbackBackendService;

    @Override
    @Operation(summary = "审核反馈")
    @PostMapping("/auditFeedback")
    public BizResponse<Boolean> auditFeedback(@RequestBody AuditFeedbackReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return feedbackBackendService.auditFeedback(req);
    }

    @Override
    @Operation(summary = "多条件查询反馈")
    @PostMapping("/queryFeedbackByCondition")
    public BizPageResponse<QueryFeedbackByConditionResp> queryFeedbackByCondition(@RequestBody QueryFeedbackByConditionReq req) {
        if (req == null) {
            return BizPageResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizPageResponse.paramError("参数错误");
        }
        return feedbackBackendService.queryFeedbackByCondition(req);
    }

    @Override
    @Operation(summary = "根据主键查询反馈信息")
    @PostMapping("/queryFeedbackById")
    public BizResponse<QueryFeedbackByIdResp> queryFeedbackById(@RequestBody QueryFeedbackByIdReq req) {
        if (req == null) {
            return BizResponse.paramError("参数为空");
        }
        if (!req.baseCheck()) {
            return BizResponse.paramError("参数错误");
        }
        return feedbackBackendService.queryFeedbackById(req);
    }
}
